package dq.study.springcache;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dongqun
 * @date 2020/8/24 15:22
 */
@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private TestService testService;


    @GetMapping("/add")
    public int add(int a, int b) {
        return testService.add(a, b);
    }

    @GetMapping("/reduce")
    public int reduce(int a, int b) {
        return testService.reduce(a, b);
    }

    @GetMapping("/add1+1")
    public int add() {
        return testService.add();
    }

    @GetMapping("/evit")
    public void evit() {
        testService.evit();
    }

    @GetMapping("/evitall")
    public void evitAll() {
        testService.evitAll();
    }

    @GetMapping("/one")
    public Test getOne(int id) {
        return testService.getOne(id);
    }

    @PostMapping("/one")
    public Test updateOne(int id, String content) {
        return testService.udpate(id, content);
    }

    @GetMapping("/user")
    public User getUser(String name, Integer age, String sex) {
        return testService.getUser(name, age, sex);
    }
}
